<%= form_tag("../user_books?collection_id=" + params[:collection_id], :method => "put") do |f| %>

	<% # = f.hidden_field @books.first.collection_id
	%>

    <table>
      <tr>
        <th>Tome</th>
        <th>Price</th>
        <th>Description</th>
        <th>Owned</th>
      </tr>
    
      <%= @books.each do |book| %>
        <tr>
          <td><%= book.title %></td>
          <td><%= book.price %></td>
          <td><%= book.description %></td>
          <% if !UserBook.where("user_id = ? AND book_id = ?", current_user.id, book.id).empty? %>
            <td><%= check_box(book.id, "book_id", :checked => true) %></td> 
          <% else %>
            <td><%= check_box(book.id, "book_id") %></td> 
          <% end %>
        </tr>
      <% end %>
    </table>
    <%= submit_tag("Update") %>
<% end %>
